#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_database5.py
# author:wmf
# datetime:2021/5/16 22:53
# software: PyCharm
'''
this is function description
'''
# import module your need
import mysql.connector

mydb = mysql.connector.connect(
    host="localhost",
    user="root",
    passwd="1535122923Wmf",
    database="python"
)

mycursor = mydb.cursor()

sql = "INSERT INTO sites(name,url) VALUE(%s,%s)"
val = ("百度", "https://www.baidu.com")
mycursor.execute(sql, val)

mydb.commit()  # 数据表内容有更新，必须使用到该语句

print(mycursor.rowcount, "记录插入成功。")
